package cn.tedu.spring.bean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class UserService {
    @Value("业务名称")
    private String name;

    // 注入对象
    /*
    @Autowired 注入对象或者接口,自动装配
    添加位置：
    1、属性上
    2、set方法上
    3、构造方法上


     */
    // @Autowired
    private UserDao userDao;


    // 添加在构造方法上
    public UserService(@Autowired UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public String toString() {
        return "UserService{" +
                "name='" + name + '\'' +
                ", userDao=" + userDao +
                '}';
    }
}
